(()=>{
    const app = new Vue({
        el:'#header',
        data:{
            bankLIst:[]
        }
    });

    //======添加卡号=======
    app.addBank = (index)=>{
        layer.open({
            type: 2,
            title: false,
            closeBtn: false,
            area: ['500px', '450px'],
            content: DUSER + '/add_bank',
            end: function () {
                shuJu()
            }
        });
    };
    //======删除卡号=======
    app.deleteBank = (index)=>{
        layer.confirm('确定要删除',function () {
            $.post(DUSER+'/delete_bank',{id:app.bankLIst[index].bankid});
            app.bankLIst.splice(index,1);
            layer.closeAll();
        });

    };
    //======编辑卡号=======
    app.updateBank = (index)=>{
        layer.open({
            type: 2,
            title: false,
            closeBtn: false,
            area: ['500px', '450px'],
            content: DUSER + '/update_bank/id/'+(app.bankLIst[index].bankid),
            end: function () {
                shuJu()
            }
        });
    };

    //开始获取数据
    function shuJu() {
        $.get(DUSER+'/bank',function (da) {
            app.bankLIst = da;
        })
    }
    shuJu()
})();